<template>
  <TbTitle title="（五）党建工作情况" />
  <div class="msg-tip">
    <div style="display: flex; align-items: center">
      是否建立党组织：
      <el-switch inline-prompt v-model="yes1" disabled active-text="是" inactive-text="否">
      </el-switch>
    </div>
    <div style="display: flex; align-items: center">
      是否将党的建设和社会主义核心价值观写入章程：
      <el-switch inline-prompt v-model="yes2" disabled active-text="是" inactive-text="否">
      </el-switch>
    </div>
    <div style="display: flex; align-items: center" v-if="!yes2">
      原因：
      {{ detailInfo.partyBuildConstitutionReason }}
    </div>
  </div>
  <table border="0" class="m-table" v-if="detailInfo.partyOrganization == 1">
    <tr>
      <td rowspan="7">基本情况</td>
      <td>党组织名称</td>
      <td colspan="2">
        <span>{{ detailInfo.partyBuildingName }}</span>
      </td>
      <td>党组织类型</td>
      <td colspan="2">{{ dictToVal(dict1, detailInfo.partyBuildingType) }}</td>
    </tr>
    <tr>
      <td>党组织隶属关系</td>
      <td colspan="5"><span>{{ dictToVal(dict2, detailInfo.partyBuildingRelationship) }}</span></td>
    </tr>
    <tr>
      <td rowspan="3">党组织书记</td>
      <td>姓名</td>
      <td colspan="2">在社会组织中所任职务</td>
      <td colspan="2">手机号码</td>
    </tr>
    <tr>
      <td><span>{{ detailInfo.partyBuildingSecretaryName }}</span></td>
      <td colspan="2"><span>{{ detailInfo.partyBuildingSecretaryDirectorPosition }}</span></td>
      <td colspan="2"><span>{{ detailInfo.partyWorkContactPhone }}</span></td>
    </tr>
    <tr>
      <td>参与内部治理情况</td>
      <td colspan="4"><span>{{ dictToVal(dict3, detailInfo.internalGovernanceSituation) }}</span></td>
    </tr>
    <tr>
      <td rowspan="2">党建工作联系人</td>
      <td>姓名</td>
      <td colspan="2">在社会组织中所任职务</td>
      <td colspan="2">手机号码（对外公布隐去）</td>
    </tr>
    <tr>
      <td><span>{{ detailInfo.partyWorkContactName }}</span></td>
      <td colspan="2"><span>{{ detailInfo.partyWorkContactDirectorPosition }}</span></td>
      <td colspan="2"><span>{{ detailInfo.partyWorkContactPhone }}</span></td>
    </tr>
    <tr>
      <td rowspan="6">党员人数</td>
      <td>党员总人数</td>
      <td colspan="2"><span>{{ detailInfo.partyMembersCount }}</span></td>
      <td>其中：女党员人数</td>
      <td colspan="2"><span>{{ detailInfo.partyMembersWomanCount }}</span></td>
    </tr>
    <tr>
      <td>35岁以下党员人数</td>
      <td style="width: 100px;"><span>{{ detailInfo.ageHirtyFiveCount }}</span></td>
      <td>36岁至45岁党员人数</td>
      <td><span>{{ detailInfo.ageHirtySixCount }}</span></td>
      <td>45岁以上党员人数</td>
      <td style="width: 100px;"><span>{{ detailInfo.ageFortyFiveCount }}</span></td>
    </tr>
    <tr>
      <td>初中以下党员人数</td>
      <td><span>{{ detailInfo.schoolJuniorCount }}</span></td>
      <td>高中(中专、大专)党员人数</td>
      <td><span>{{ detailInfo.schoolHighCount }}</span></td>
      <td>本科以上党员人数</td>
      <td><span>{{ detailInfo.schoolUniversityCount }}</span></td>
    </tr>
    <tr>
      <td>流动党员数</td>
      <td><span>{{ detailInfo.partyMembersFlowCount }}</span></td>
      <td>持临时组织关系人数</td>
      <td><span>{{ detailInfo.partyMembersTemporaryCount }}</span></td>
      <td>持流动党员活动证人数</td>
      <td><span>{{ detailInfo.partyMembersFlowCardCount }}</span></td>
    </tr>
    <tr>
      <td>专职人员中党员人数</td>
      <td colspan="2"><span>{{ detailInfo.partyMembersFullTimeCount }}</span></td>
      <td>兼职人员中党员人数</td>
      <td colspan="2"><span>{{ detailInfo.partyMembersPartTimeCount }}</span></td>
    </tr>
    <tr>
      <td>专职党务工作者人数</td>
      <td colspan="2"><span>{{ detailInfo.partyWorkFullTimeCount }}</span></td>
      <td>兼职党务工作者人数</td>
      <td colspan="2"><span>{{ detailInfo.partyWorkPartTimeCount }}</span></td>
    </tr>
    <tr>
      <td>最近两年发展党员情况</td>
      <td>{{ examineYear - 1 }}年发展党员人数</td>
      <td colspan="2"><span>{{ detailInfo.partyWorkBeforeYears }}</span></td>
      <td>{{ examineYear }}年发展党员人数</td>
      <td colspan="2"><span>{{ detailInfo.partyWorkLastYears }}</span></td>
    </tr>
    <tr>
      <td rowspan="3">活动情况</td>
      <td>是否有专门活动场所</td>
      <td><span>{{ yesNoBool(detailInfo.specialEventVenue) }}</span></td>
      <td>活动经费数额</td>
      <td>
        <span>{{ detailInfo.activityFunds }}</span>
        元/年
      </td>
      <td>活动经费来源</td>
      <td><span>{{ detailInfo.activityFundsSource }}</span></td>
    </tr>
    <tr>
      <td rowspan="2">组织生活开展次数</td>
      <td>党员大会</td>
      <td>支委会</td>
      <td>党小组会</td>
      <td colspan="2">党课</td>
    </tr>
    <tr>
      <td>
        <span>{{ detailInfo.partyMemberConferenceNum }}</span>
        次
      </td>
      <td>
        <span>{{ detailInfo.branchCommitteeNum }}</span>
        次
      </td>
      <td>
        <span>{{ detailInfo.partyGroupNum }}</span>
        次
      </td>
      <td colspan="2">
        <span>{{ detailInfo.partyCoursesNum }}</span>
        次
      </td>
    </tr>
    <tr>
      <td rowspan="2">群团工作</td>
      <td>是否建立工会</td>
      <td><span>{{ yesNoBool(detailInfo.establishingTradeUnions) }}</span></td>
      <td>是否建立团组织</td>
      <td><span>{{ yesNoBool(detailInfo.establishingTeam) }}</span></td>
      <td>是否建立妇联</td>
      <td><span>{{ yesNoBool(detailInfo.establishingWomenFederation) }}</span></td>
    </tr>
    <tr>
      <td>群团组织开展活动次数</td>
      <td colspan="5"><span>{{ detailInfo.teamActivitieNum }}</span></td>
    </tr>
  </table>

  <table border="0" class="m-table" v-if="detailInfo.partyOrganization == 2">
    <tr>
      <td colspan="2">未建党组织原因</td>
      <td colspan="5"><span>{{ detailInfo.notCreatePartyReason }}</span></td>
    </tr>
    <tr>
      <td rowspan="2">群团工作</td>
      <td>是否建立工会</td>
      <td><span>{{ yesNoBool(detailInfo.establishingTradeUnions) }}</span></td>
      <td>是否建立团组织</td>
      <td><span>{{ yesNoBool(detailInfo.establishingTeam) }}</span></td>
      <td>是否建立妇联</td>
      <td><span>{{ yesNoBool(detailInfo.establishingWomenFederation) }}</span></td>
    </tr>
    <tr>
      <td colspan="2">群团组织开展活动次数</td>
      <td colspan="4">
        <span>{{ detailInfo.teamActivitieNum }}</span>
        次
      </td>
    </tr>
    <tr>
      <td>现有妇女人数</td>
      <td colspan="2"><span>{{ detailInfo.womanNumCount }}</span></td>
      <td colspan="2">现有28周岁以下青年人数</td>
      <td colspan="2"><span>{{ detailInfo.ageTwentyEightCount }}</span></td>
    </tr>
    <tr>
      <td rowspan="7">党员人数</td>
      <td>党员总人数</td>
      <td colspan="2"><span>{{ detailInfo.partyMembersCount }}</span></td>
      <td>其中：女党员人数</td>
      <td colspan="2"><span>{{ detailInfo.partyMembersWomanCount }}</span></td>
    </tr>
    <tr>
      <td>35岁以下党员人数</td>
      <td style="width: 100px;"><span>{{ detailInfo.ageHirtyFiveCount }}</span></td>
      <td>36岁至45岁党员人数</td>
      <td><span>{{ detailInfo.ageHirtySixCount }}</span></td>
      <td>45岁以上党员人数</td>
      <td style="width: 100px;"><span>{{ detailInfo.ageFortyFiveCount }}</span></td>
    </tr>
    <tr>
      <td>初中以下党员人数</td>
      <td><span>{{ detailInfo.schoolJuniorCount }}</span></td>
      <td>高中（中专）党员人数</td>
      <td><span>{{ detailInfo.schoolHighCount }}</span></td>
      <td>大专及以上党员人数</td>
      <td><span>{{ detailInfo.schoolUniversityCount }}</span></td>
    </tr>
    <tr>
      <td>流动党员数</td>
      <td><span>{{ detailInfo.partyMembersFlowCount }}</span></td>
      <td>持临时组织关系人数</td>
      <td><span>{{ detailInfo.partyMembersTemporaryCount }}</span></td>
      <td>持流动党员活动证人数</td>
      <td><span>{{ detailInfo.partyMembersFlowCardCount }}</span></td>
    </tr>
    <tr>
      <td>流动党员参加组织生活情况</td>
      <td colspan="5"><span>{{ detailInfo.flowPartyMemberJoinLife }}</span></td>
    </tr>
    <tr>
      <td>专职人员中党员人数</td>
      <td colspan="2"><span>{{ detailInfo.partyMembersFullTimeCount }}</span></td>
      <td>兼职人员中党员人数</td>
      <td colspan="2"><span>{{ detailInfo.partyMembersPartTimeCount }}</span></td>
    </tr>
    <tr>
      <td>专职党务工作者人数</td>
      <td colspan="2"><span>{{ detailInfo.partyWorkFullTimeCount }}</span></td>
      <td>兼职党务工作者人数</td>
      <td colspan="2"><span>{{ detailInfo.partyWorkPartTimeCount }}</span></td>
    </tr>
    <tr>
      <td rowspan="2">党建工作联络员</td>
      <td colspan="2">姓名</td>
      <td colspan="2">联系方式</td>
      <td colspan="2">派出单位</td>
    </tr>
    <tr>
      <td colspan="2"><span>{{ detailInfo.partyBuildingUserName }}</span></td>
      <td colspan="2"><span>{{ detailInfo.partyBuildingUserPhone }}</span></td>
      <td colspan="2"><span>{{ detailInfo.partyBuildingUserOrg }}</span></td>
    </tr>
  </table>
</template>

<script setup lang="ts">
import { ref, inject, reactive } from 'vue'
import { getDictJoinInsideGovern, getDictPartyAffiliation, getDictPartyOrg } from '@/api/dict'

// 这里的deptTableData模拟从后端获取的数据
let yes1 = ref()
let yes2 = ref()
let examineYear = ref()

let detailInfo = reactive({})
const { getDetailInfo } = inject('getDetailInfo')


const yesNoBool = (val) => {
  return (val - 0) == 1 ? '是' : (val - 0) == 2 ? '否' : '否'
}

getDetailInfo().then(res => {
  Object.assign(detailInfo, res.data)
  examineYear.value = res.examineYear
  yes1.value = detailInfo.partyOrganization == 1 ? true : false
  yes2.value = detailInfo.partyBuildSocialistCoreValuesConstitution == 1 ? true : false
})

const dict1 = ref([])
const dict2 = ref([])
const dict3 = ref([])
const dictToVal = (dictList, val) => {
  for (let i = 0; i < dictList.length; i++) {
    if (val == dictList[i].id) {
      return dictList[i].name
    }
  }
}

let getDictInfo = () => {
  //党组织类型
  getDictPartyOrg().then(res => {
    dict1.value = res.data
  })
  //党组织隶属关系
  getDictPartyAffiliation().then(res => {
    dict2.value = res.data
  })
  //参与内部治理情况
  getDictJoinInsideGovern().then(res => {
    dict3.value = res.data
  })
}
getDictInfo()
</script>
<style lang="scss" scoped>
.msg-tip {
  padding: 20px 0;
  color: #000;
  font-family: '微软雅黑';
}
</style>
